<?php
/**
 * Created by PhpStorm.
 * User: 技术员专用
 * Date: 2019/2/15
 * Time: 14:15
 */

namespace app\index\controller;

use Hanson\Vbot\Message\Text;
use Hanson\Vbot\Message\Emoticon;
use Illuminate\Support\Collection;
use Hanson\Vbot\Contact\Friends;
use Hanson\Vbot\Contact\Groups;
use Hanson\Vbot\Contact\Members;
class MessageHandler
{
    public static function messageHandler(Collection $message){
//        $friend=vbot('friend');
//
//        $members = vbot('members');
//
//        $groups = vbot('groups');

        if ($message['fromType'] === 'Friend') {
            vbot('console')->log('这是好友发送的消息');
            Text::send($message['from']['UserName'], 'Vbot测试,我接收到你的消息了');
        }
        if ($message['fromType'] === 'Group') {
            if($message['isAt']){
                vbot('console')->log('这是好友发送的消息');
                Text::send($message['from']['UserName'], 'Vbot测试,I was @');
            }
        }
    }

}